package com.ruoyi.find.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.find.domain.SysRegion;
import com.ruoyi.find.mapper.SysRegionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.find.mapper.SysSubwayMapper;
import com.ruoyi.find.domain.SysSubway;
import com.ruoyi.find.service.ISysSubwayService;

/**
 * 地铁线路Service业务层处理
 * 
 * @author LiuWeiChen
 * @date 2025-09-12
 */
@Service
public class SysSubwayServiceImpl implements ISysSubwayService 
{
    @Autowired
    private SysSubwayMapper sysSubwayMapper;
    @Autowired
    private SysRegionMapper regionMapper;

    /**
     * 查询地铁线路
     * 
     * @param subwayId 地铁线路主键
     * @return 地铁线路
     */
    @Override
    public SysSubway selectSysSubwayBySubwayId(Long subwayId)
    {
        return sysSubwayMapper.selectSysSubwayBySubwayId(subwayId);
    }

    /**
     * 查询地铁线路列表
     * 
     * @param sysSubway 地铁线路
     * @return 地铁线路
     */
    @Override
    public List<SysSubway> selectSysSubwayList(SysSubway sysSubway)
    {
        return sysSubwayMapper.selectSysSubwayList(sysSubway);
    }

    /**
     * 新增地铁线路
     * 
     * @param sysSubway 地铁线路
     * @return 结果
     */
    @Override
    public int insertSysSubway(SysSubway sysSubway)
    {
        sysSubway.setCreateTime(DateUtils.getNowDate());
        return sysSubwayMapper.insertSysSubway(sysSubway);
    }

    /**
     * 修改地铁线路
     * 
     * @param sysSubway 地铁线路
     * @return 结果
     */
    @Override
    public int updateSysSubway(SysSubway sysSubway)
    {
        sysSubway.setUpdateTime(DateUtils.getNowDate());
        return sysSubwayMapper.updateSysSubway(sysSubway);
    }

    /**
     * 批量删除地铁线路
     * 
     * @param subwayIds 需要删除的地铁线路主键
     * @return 结果
     */
    @Override
    public int deleteSysSubwayBySubwayIds(Long[] subwayIds)
    {
        return sysSubwayMapper.deleteSysSubwayBySubwayIds(subwayIds);
    }

    /**
     * 删除地铁线路信息
     * 
     * @param subwayId 地铁线路主键
     * @return 结果
     */
    @Override
    public int deleteSysSubwayBySubwayId(Long subwayId)
    {
        return sysSubwayMapper.deleteSysSubwayBySubwayId(subwayId);
    }

    @Override
    public AjaxResult getRegion() {
        List<SysRegion> regionList = regionMapper.selectSysRegionList(null);
        return AjaxResult.success(regionList);
    }
}
